package com.woniuxy.kaer.commons.exception;


import com.woniuxy.kaer.commons.util.Result;
import com.woniuxy.kaer.commons.util.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(value = AuthException.class)
    public Result handlerException(AuthException e){

        return Result.auth(40001,e.getMessage());
    }

    @ExceptionHandler(value = Exception.class)
    public Result handlerException(Exception e){
        e.printStackTrace();
        return Result.fail(500,e.getMessage());
    }


}
